using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Protocol;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.Page
{
	public class WhatsnewPage : BasePage
	{
		private const string TAG = "WhatsnewPage";
		private object[] mPageArgs;
		private EventWatcher mWatchContactListChange;
		internal Grid LayoutRoot;
		private bool _contentLoaded;
		public WhatsnewPage()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.Page_Loaded));
			base.add_Unloaded(new RoutedEventHandler(this.Page_Unloaded));
		}
		private void Page_Loaded(object sender, RoutedEventArgs e)
		{
			Log.smethod_5("WhatsnewPage", "Page_Loaded");
		}
		private void Page_Unloaded(object sender, RoutedEventArgs e)
		{
			Log.smethod_5("WhatsnewPage", "Page_Loaded");
		}
		protected override void OnPageIn(object[] object_0)
		{
			Log.smethod_5("WhatsnewPage", "OnPageIn");
			this.mPageArgs = object_0;
			bool oldUser = false;
			if (object_0 != null && object_0.Length != 0 && object_0[0].GetType() == typeof(bool))
			{
				oldUser = (bool)object_0[0];
			}
			this.startWhatsnew(oldUser);
		}
		protected override void OnPageOut()
		{
			Log.smethod_5("WhatsnewPage", "OnPageOut");
		}
		protected override void OnPageBack()
		{
			Log.smethod_5("WhatsnewPage", "OnPageBack");
		}
		private void startWhatsnew(bool oldUser)
		{
			if (!oldUser)
			{
				WhatsNewForNewUser whatsNewForNewUser = WhatsNewForNewUser.ShowWhatsNew(WhatsNewKind.NewUser);
				whatsNewForNewUser.ReturnEvent = new DlgReturnEvent(this.whatsNewFinish);
				return;
			}
			WhatsNew whatsNew = WhatsNew.ShowWhatsNew(WhatsNewKind.NewUser);
			whatsNew.ReturnEvent = new DlgReturnEvent(this.whatsNewFinish);
		}
		private void whatsNewFinish(DlgReturnEventArg dlgReturnEventArg_0)
		{
			ConfigMgr.setInt("nVersionNumKey", (int)ConstantsProtocol.CLIENT_VERSION);
			base.GoToPage("/Source/UI/MainPage.xaml", this.mPageArgs, true);
		}
		private void registerEvent()
		{
			if (this.mWatchContactListChange == null)
			{
				this.mWatchContactListChange = new EventWatcher(this, this, new EventHandlerDelegate(this.OnContactChange));
				EventCenter.registerEventWatcher(EventConst.ON_STORAGE_CONTACT_ADD, this.mWatchContactListChange);
			}
		}
		private void unRegisterEvent()
		{
			if (this.mWatchContactListChange != null)
			{
				EventCenter.removeEventWatcher(EventConst.ON_STORAGE_CONTACT_ADD, this.mWatchContactListChange);
				this.mWatchContactListChange = null;
			}
		}
		private void OnContactChange(EventWatcher watcher, BaseEventArgs evtArgs)
		{
		}
		protected override void OnBackKeyPress(CancelEventArgs cancelEventArgs_0)
		{
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/WhatsnewPage.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
		}
	}
}
